import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      "@": resolve(__dirname, "src"),
    }
  },
  server: {
    open: true, // 是否自动在浏览器打开
  },
  build: {
    rollupOptions: {
      input: {
        app1: resolve(__dirname, 'src/packages/app1/index.html'),
        app2: resolve(__dirname, 'src/packages/app2/index.html')
      },
      output: {
          chunkFileNames: 'js/[name]-[hash].js',
          entryFileNames: 'js/[name]-[hash].js',
          assetFileNames: '[ext]/[name]-[hash].[ext]',
      }
    }
  }
})
